package example.exception;

/**
 * Created by lenovo on 2016/11/7 0007.
 * 异常的捕获，处理。
 */
public class CatchException {
    public static void main(String[] args) {
        try {
            throw new Exception("My Exception");
        } catch (Exception e) {//本节使用system.err.println模拟处理异常
            System.err.println("Caught Exception");
            System.err.println("getMessage():" + e.getMessage());
            System.err.println("getLocalizedMessage():"
                    + e.getLocalizedMessage());
            System.err.println("toString():" + e);
            System.err.println("printStackTrace():");
            e.printStackTrace();
        }
    }
}
